home *** CD-ROM | disk | FTP | other *** search
/ Amiga Aktuell / Amiga Aktuell.iso / searchtools / find.rexx < prev    next >
OS/2 REXX Batch file  |  1996-09-05  |  1KB  |  41 lines

  1. /*ArexxFind (c) Frank Röchter*/
  2. Say "You can specify more than one word by dividing them by a space character"
  3. Say "Type in the words you want to search for:"
  4. Pull find
  5. if find~="" then do
  6.    find=upper(find)
  7.    Say "Please wait..."
  8.    open("I","Amiga-Aktuell-1:searchtools/"||ARG(1)||".qfind","READ")
  9.    t=time("S")
  10.    open("O","t:found"||t,"WRITE")
  11.    found=0
  12.    Writeln("O","Your word(s): "||find)
  13.    do while eof("I")=0
  14.       line=readln("I")
  15.       line2=upper(line)
  16.       W=words(find)
  17.       do while w>0
  18.          idx=index(line2,word(find,w))
  19.          if idx~=0 then do
  20.             w=w-1
  21.             if w=0 then do
  22.                if found=0 then do
  23.                   Writeln("O","The following directorys contain your words:")
  24.                   Writeln("O","")
  25.                   found=1
  26.                end
  27.                Writeln("O",line)
  28.             end
  29.          end
  30.          if idx=0 then w=0
  31.       end
  32.    end
  33.    if found=0 then do
  34.       Writeln("O","Sorry, your word does not exist in any directory of this CD")
  35.    end
  36.    Close("I")
  37.    Close("O")
  38.    ADDRESS COMMAND "Amiga-Aktuell-1:c/Next t:found"||t
  39.    ADDRESS COMMAND "delete >nil: t:found"||t
  40. end
  41.